const crypto= require('crypto')
// const t = 'ydsecret://query/key/B*RGygVywfNBwpmBaZg*WT7SIOUP2T0C9WHMZN39j^DAdaZhAnxvGcCY6VYFwnHl';
// const a = 'ydsecret://query/iv/C@lZe2YzHtZ2CYgaXKSVfsb7Y4QWHjITPPZ0nQp87fBeJ!Iv6v^6fvi2WN@bYpJ4';
function T(e) {
    return crypto.createHash("md5").update(e).digest()
}
function decodeData(e,t,a){
    // 解密翻译后加密的数据
        if (!e)
            return null;
        const o =  Buffer.alloc(16, T(t))
          , n = Buffer.alloc(16, T(a))
          , r = crypto.createDecipheriv("aes-128-cbc", o, n);
        let s = r.update(e, "base64", "utf-8");
        return s += r.final("utf-8"),
        s
}
function _(e) {
    return crypto.createHash("md5").update(e.toString()).digest("hex")
}
function sign(timestamp, t) {
    var d = 'fanyideskweb'
    var u = 'webfanyi'
    // var t = 'asdjnjfenknafdfsdfsd'
    // var t = 'Vy4EQ1uwPkUoqvcP1nIu6WiAjxFeA3Y9'
    return _(`client=${d}&mysticTime=${timestamp}&product=${u}&key=${t}`)
}
// console.log(decodeData('Z21kD9ZK1ke6ugku2ccWu4n6eLnvoDT0YgGi0y3g-v0B9sYqg8L9D6UERNozYOHqnYdl2efZNyM6Trc_xS-zKtfTK4hb6JP8XwCzNh0avc8qItQUiIU_4wKKXJlIpvMvfKvJaaZzaX6VEtpkr2FdkfoT_Jgbm2GRSVj3r40autIdlImENG8hC0ZH4ww7utwuTt3Oo_ZpXg0BSq9wePSAB75-ChkiGKF9HTIPeCl2bl84SBD1XDfFCZpkKQhecYSs0JLoXOqP2ltavxRrg58Hp1q5uIgZZ_Oo2-Jmd-t1r4es40drcAq5bjmS62M2VJF8D6ojtOh9JTfNwgzD3CxYn-Pd7-TgHMyNEJEkFXTAyxzpjlFqtrCYDE3SZUYlENkqsL8Wrra1hM-1n TfiB-BLcWAdRBynNpP5_54aq_-GBsq8bB_9yEX5ovzDB4_Ry_spVVuUnb39iplMHCdCnjOD3ngiIDbl9SUz-9n p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